package Day12_String类;

public class ZuoYe01 {
    public static void main(String[] args) {
        student1 s1 = new student1();
        s1.setName("张岩");
        s1.setAge(20);
        s1.show();

        student1 s2 = new student1("张研", 18);
        s2.show();
    }
}

class student1 {
    //成员变量私有化
    private String name;
    private int age;

    //无参构造
    public student1() {

    }

    //有参构造
    public student1(String name, int age) {
        this.name = name;
        this.age = age;
    }
    //get set方法

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void show() {
        System.out.println("姓名" + name + "年龄" + age);
    }
}
